// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

import type { NextApiRequest, NextApiResponse } from 'next';

// 泛型 定义response类型
type Data = {
  name: string
}

// http://localhost:3000/api/hello
export default (req: NextApiRequest, res: NextApiResponse<Data>) => {
  // res.statusCode = 200
  // res.json({ name: 'John Doe' })
  res.status(200).json({ name: 'John Doe' })
}
